<?php
/**
 * SBCampaignBase
 *
 * PHP version 5
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */

/**
 * Amazon Ads API - Sponsored Brands
 *
 * Use the Amazon Ads API for Sponsored Brands for campaign, ad group, keyword, negative keyword, drafts, Stores, landing pages, and Brands management operations. For more information about Sponsored Brands, see the [Sponsored Brands Support Center](https://advertising.amazon.com/help#GQFZA83P55P747BZ). For onboarding information, see the [account setup](https://advertising.amazon.com/API/docs/v3/guides/account_setup) topic.
 *
 * OpenAPI spec version: 3.0
 * 
 * Generated by:https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api.git
 * AmazonAdvertisingApi Codegen version: 3.0.51
 */
/**
 * NOTE: This class is auto generated by the AmazonAdvertisingApi code generator program.
 *https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 * Do not edit the class manually.
 */

namespace AmazonAdvertisingApi\Model;

use \ArrayAccess;
use \AmazonAdvertisingApi\ObjectSerializer;

/**
 * SBCampaignBase Class Doc Comment
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */
class SBCampaignBase implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $AmazonAdvertisingApiModelName = 'SBCampaignBase';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiTypes = [
        'campaign_id' => 'int',
        'name' => '\AmazonAdvertisingApi\Model\SBCampaignName',
        'tags' => '\AmazonAdvertisingApi\Model\CampaignTags',
        'budget' => 'float',
        'budget_type' => '\AmazonAdvertisingApi\Model\BudgetType',
        'start_date' => '\AmazonAdvertisingApi\Model\StartDate',
        'end_date' => '\AmazonAdvertisingApi\Model\EndDate',
        'state' => 'AllOfSBCampaignBaseState',
        'serving_status' => 'string',
        'brand_entity_id' => 'string',
        'portfolio_id' => 'int',
        'ad_format' => '\AmazonAdvertisingApi\Model\AdFormat'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiFormats = [
        'campaign_id' => 'int64',
        'name' => null,
        'tags' => null,
        'budget' => null,
        'budget_type' => null,
        'start_date' => null,
        'end_date' => null,
        'state' => null,
        'serving_status' => null,
        'brand_entity_id' => null,
        'portfolio_id' => 'int64',
        'ad_format' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiTypes()
    {
        return self::$AmazonAdvertisingApiTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiFormats()
    {
        return self::$AmazonAdvertisingApiFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'campaign_id' => 'campaignId',
        'name' => 'name',
        'tags' => 'tags',
        'budget' => 'budget',
        'budget_type' => 'budgetType',
        'start_date' => 'startDate',
        'end_date' => 'endDate',
        'state' => 'state',
        'serving_status' => 'servingStatus',
        'brand_entity_id' => 'brandEntityId',
        'portfolio_id' => 'portfolioId',
        'ad_format' => 'adFormat'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'campaign_id' => 'setCampaignId',
        'name' => 'setName',
        'tags' => 'setTags',
        'budget' => 'setBudget',
        'budget_type' => 'setBudgetType',
        'start_date' => 'setStartDate',
        'end_date' => 'setEndDate',
        'state' => 'setState',
        'serving_status' => 'setServingStatus',
        'brand_entity_id' => 'setBrandEntityId',
        'portfolio_id' => 'setPortfolioId',
        'ad_format' => 'setAdFormat'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'campaign_id' => 'getCampaignId',
        'name' => 'getName',
        'tags' => 'getTags',
        'budget' => 'getBudget',
        'budget_type' => 'getBudgetType',
        'start_date' => 'getStartDate',
        'end_date' => 'getEndDate',
        'state' => 'getState',
        'serving_status' => 'getServingStatus',
        'brand_entity_id' => 'getBrandEntityId',
        'portfolio_id' => 'getPortfolioId',
        'ad_format' => 'getAdFormat'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$AmazonAdvertisingApiModelName;
    }

    const SERVING_STATUS_ASIN_NOT_BUYABLE = 'ASIN_NOT_BUYABLE';
    const SERVING_STATUS_BILLING_ERROR = 'BILLING_ERROR';
    const SERVING_STATUS_ENDED = 'ENDED';
    const SERVING_STATUS_LANDING_PAGE_NOT_AVAILABLE = 'LANDING_PAGE_NOT_AVAILABLE';
    const SERVING_STATUS_OUT_OF_BUDGET = 'OUT_OF_BUDGET';
    const SERVING_STATUS_PAUSED = 'PAUSED';
    const SERVING_STATUS_PENDING_REVIEW = 'PENDING_REVIEW';
    const SERVING_STATUS_READY = 'READY';
    const SERVING_STATUS_REJECTED = 'REJECTED';
    const SERVING_STATUS_RUNNING = 'RUNNING';
    const SERVING_STATUS_SCHEDULED = 'SCHEDULED';
    const SERVING_STATUS_TERMINATED = 'TERMINATED';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getServingStatusAllowableValues()
    {
        return [
            self::SERVING_STATUS_ASIN_NOT_BUYABLE,
            self::SERVING_STATUS_BILLING_ERROR,
            self::SERVING_STATUS_ENDED,
            self::SERVING_STATUS_LANDING_PAGE_NOT_AVAILABLE,
            self::SERVING_STATUS_OUT_OF_BUDGET,
            self::SERVING_STATUS_PAUSED,
            self::SERVING_STATUS_PENDING_REVIEW,
            self::SERVING_STATUS_READY,
            self::SERVING_STATUS_REJECTED,
            self::SERVING_STATUS_RUNNING,
            self::SERVING_STATUS_SCHEDULED,
            self::SERVING_STATUS_TERMINATED,
        ];
    }

    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['campaign_id'] = isset($data['campaign_id']) ? $data['campaign_id'] : null;
        $this->container['name'] = isset($data['name']) ? $data['name'] : null;
        $this->container['tags'] = isset($data['tags']) ? $data['tags'] : null;
        $this->container['budget'] = isset($data['budget']) ? $data['budget'] : null;
        $this->container['budget_type'] = isset($data['budget_type']) ? $data['budget_type'] : null;
        $this->container['start_date'] = isset($data['start_date']) ? $data['start_date'] : null;
        $this->container['end_date'] = isset($data['end_date']) ? $data['end_date'] : null;
        $this->container['state'] = isset($data['state']) ? $data['state'] : null;
        $this->container['serving_status'] = isset($data['serving_status']) ? $data['serving_status'] : null;
        $this->container['brand_entity_id'] = isset($data['brand_entity_id']) ? $data['brand_entity_id'] : null;
        $this->container['portfolio_id'] = isset($data['portfolio_id']) ? $data['portfolio_id'] : null;
        $this->container['ad_format'] = isset($data['ad_format']) ? $data['ad_format'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        $allowedValues = $this->getServingStatusAllowableValues();
        if (!is_null($this->container['serving_status']) && !in_array($this->container['serving_status'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'serving_status', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets campaign_id
     *
     * @return int
     */
    public function getCampaignId()
    {
        return $this->container['campaign_id'];
    }

    /**
     * Sets campaign_id
     *
     * @param int $campaign_id The campaign identifier.
     *
     * @return $this
     */
    public function setCampaignId($campaign_id)
    {
        $this->container['campaign_id'] = $campaign_id;

        return $this;
    }

    /**
     * Gets name
     *
     * @return \AmazonAdvertisingApi\Model\SBCampaignName
     */
    public function getName()
    {
        return $this->container['name'];
    }

    /**
     * Sets name
     *
     * @param \AmazonAdvertisingApi\Model\SBCampaignName $name name
     *
     * @return $this
     */
    public function setName($name)
    {
        $this->container['name'] = $name;

        return $this;
    }

    /**
     * Gets tags
     *
     * @return \AmazonAdvertisingApi\Model\CampaignTags
     */
    public function getTags()
    {
        return $this->container['tags'];
    }

    /**
     * Sets tags
     *
     * @param \AmazonAdvertisingApi\Model\CampaignTags $tags tags
     *
     * @return $this
     */
    public function setTags($tags)
    {
        $this->container['tags'] = $tags;

        return $this;
    }

    /**
     * Gets budget
     *
     * @return float
     */
    public function getBudget()
    {
        return $this->container['budget'];
    }

    /**
     * Sets budget
     *
     * @param float $budget budget
     *
     * @return $this
     */
    public function setBudget($budget)
    {
        $this->container['budget'] = $budget;

        return $this;
    }

    /**
     * Gets budget_type
     *
     * @return \AmazonAdvertisingApi\Model\BudgetType
     */
    public function getBudgetType()
    {
        return $this->container['budget_type'];
    }

    /**
     * Sets budget_type
     *
     * @param \AmazonAdvertisingApi\Model\BudgetType $budget_type budget_type
     *
     * @return $this
     */
    public function setBudgetType($budget_type)
    {
        $this->container['budget_type'] = $budget_type;

        return $this;
    }

    /**
     * Gets start_date
     *
     * @return \AmazonAdvertisingApi\Model\StartDate
     */
    public function getStartDate()
    {
        return $this->container['start_date'];
    }

    /**
     * Sets start_date
     *
     * @param \AmazonAdvertisingApi\Model\StartDate $start_date start_date
     *
     * @return $this
     */
    public function setStartDate($start_date)
    {
        $this->container['start_date'] = $start_date;

        return $this;
    }

    /**
     * Gets end_date
     *
     * @return \AmazonAdvertisingApi\Model\EndDate
     */
    public function getEndDate()
    {
        return $this->container['end_date'];
    }

    /**
     * Sets end_date
     *
     * @param \AmazonAdvertisingApi\Model\EndDate $end_date end_date
     *
     * @return $this
     */
    public function setEndDate($end_date)
    {
        $this->container['end_date'] = $end_date;

        return $this;
    }

    /**
     * Gets state
     *
     * @return AllOfSBCampaignBaseState
     */
    public function getState()
    {
        return $this->container['state'];
    }

    /**
     * Sets state
     *
     * @param AllOfSBCampaignBaseState $state state
     *
     * @return $this
     */
    public function setState($state)
    {
        $this->container['state'] = $state;

        return $this;
    }

    /**
     * Gets serving_status
     *
     * @return string
     */
    public function getServingStatus()
    {
        return $this->container['serving_status'];
    }

    /**
     * Sets serving_status
     *
     * @param string $serving_status |Status|Description| |------|-----------| |ASIN_NOT_BUYABLE| The ASIN can't be purchased due to eligibility or availability.| |BILLING_ERROR| Billing information requires correction.| |ENDED| THe `endDate` specified in the campaign object occurs in the past.| |LANDING_PAGE_NOT_AVAILABLE| The specified landing page is not available. This may be caused by an incorrect address or a landing page with less than three ASINs.| |OUT_OF_BUDGET| The campaign has run out of budget.| |PAUSED| The campaign state set to `paused`.| |PENDING_REVIEW|: A newly created campaign that has not passed moderation review. Note that moderation review may take up to 72 hours.| |READY| The campaign is scheduled for a future date.| |REJECTED| The campaign failed moderation review.| |RUNNING| The campaign is enabled and serving.| |SCHEDULED| A transitive state between `ready` and `running`, as child entities associated with the campaign move to a running state.| |TERMINATED|The state of the campaign is set to `archived`.|
     *
     * @return $this
     */
    public function setServingStatus($serving_status)
    {
        $allowedValues = $this->getServingStatusAllowableValues();
        if (!is_null($serving_status) && !in_array($serving_status, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'serving_status', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['serving_status'] = $serving_status;

        return $this;
    }

    /**
     * Gets brand_entity_id
     *
     * @return string
     */
    public function getBrandEntityId()
    {
        return $this->container['brand_entity_id'];
    }

    /**
     * Sets brand_entity_id
     *
     * @param string $brand_entity_id The brand entity identifier. Note that this field is required for sellers. For more information, see the [Stores reference](https://advertising.amazon.com/API/docs/v2/reference/stores) or [Brands reference](https://advertising.amazon.com/API/docs/v3/reference/SponsoredBrands/Brands).
     *
     * @return $this
     */
    public function setBrandEntityId($brand_entity_id)
    {
        $this->container['brand_entity_id'] = $brand_entity_id;

        return $this;
    }

    /**
     * Gets portfolio_id
     *
     * @return int
     */
    public function getPortfolioId()
    {
        return $this->container['portfolio_id'];
    }

    /**
     * Sets portfolio_id
     *
     * @param int $portfolio_id The identifier of the portfolio to which the campaign is associated.
     *
     * @return $this
     */
    public function setPortfolioId($portfolio_id)
    {
        $this->container['portfolio_id'] = $portfolio_id;

        return $this;
    }

    /**
     * Gets ad_format
     *
     * @return \AmazonAdvertisingApi\Model\AdFormat
     */
    public function getAdFormat()
    {
        return $this->container['ad_format'];
    }

    /**
     * Sets ad_format
     *
     * @param \AmazonAdvertisingApi\Model\AdFormat $ad_format ad_format
     *
     * @return $this
     */
    public function setAdFormat($ad_format)
    {
        $this->container['ad_format'] = $ad_format;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
